package com.epam.employeebase.command;

import com.epam.employeebase.controller.RequestContent;

public final class ChangeEntriesPerPageCommand implements Command{
	private static final String ENTRIES_PER_PAGE_ATTRIBUTE_NAME = "entriesPerPage";
	private static final String ENTRIES_PER_PAGE_PARAMETER_NAME = "entriesPerPage";
	@Override
	public String execute(RequestContent requestContent) {
		int entriesPerPage = Integer.parseInt(requestContent.getRequestParameter(ENTRIES_PER_PAGE_PARAMETER_NAME));
		requestContent.setSessionAttribute(ENTRIES_PER_PAGE_ATTRIBUTE_NAME, entriesPerPage);
		Command nextCommand = CommandManager.getCommand(CommandType.EMPLOYEELIST);
		return nextCommand.execute(requestContent);
	}

}
